package cn.wolfcode.p2p.controller;

import cn.wolfcode.p2p.base.query.RealAuthQueryObject;
import cn.wolfcode.p2p.base.service.IRealAuthService;
import cn.wolfcode.p2p.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 后台审核页面
 */
@Controller
public class RealAuthAuditController {

    @Autowired
    private IRealAuthService realAuthService;

    /**
     * 显示审核页面
     * @param qo
     * @param model
     * @return
     */
    @RequestMapping("realAuth")
    public String realAuth(@ModelAttribute("qo") RealAuthQueryObject qo, Model model) {

        model.addAttribute("pageInfo",realAuthService.listForPage(qo));
        return "realAuth/list";
    }


    /**
     * 实名认证审核
     */
    @RequestMapping("realAuth_audit")
    @ResponseBody
    public JsonResult realAuthAudit(Long id,Integer state,String remark){
        realAuthService.audit(id,state,remark);
        return JsonResult.instance();
    }

}
